<?php
class My_Validate
{
	public static function quoteRequest()
	{
		if (!empty($_GET)) $_GET = self::quoteArray($_GET);
		if (!empty($_POST)) $_POST = self::quoteArray($_POST);
		if (!empty($_REQUEST)) $_REQUEST = self::quoteArray($_REQUEST);
		if (!empty($_COOKIE)) $_COOKIE = self::quoteArray($_COOKIE);
	}
	
	public static function quoteArray($arr)
	{
		if(!is_array($arr))
			return $arr;
		foreach ($arr as $k => $v) {
			$arr[$k] = self::quote($v);
		}
		return $arr;
	}
	
	public function quote($theValue)
	{
		if(is_array($theValue))
			return $theValue;
		$theValue = trim($theValue);
		$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
		/*$theValue = function_exists("mysql_real_escape_string") ?
		 mysql_real_escape_string($theValue) : mysql_escape_string($theValue);*/
		//$theValue = mysql_escape_string($theValue);
		return $theValue;
	}
}
?>